using System;
using System.Collections.Generic;
using System.Text;
using System.Resources;
using System.Reflection;

namespace Microsoft.Samples.BizTalk.Adapter.Tcp
{
    /// <summary>
    ///     This class represents a dispatcher exception.
    /// </summary>
    /// <author>
    ///     Paul Brown
    /// </author>
    public class DispatcherStoppedException : Exception
    {
        #region Private Instance Members

        private string  _message;   // The message associated with the exception

        #endregion

        #region Constructor

        /// <summary>
        ///     This is the default constructor for the class.
        /// </summary>
        public DispatcherStoppedException()
            : base()
        {
            // Get localized default message
            ResourceManager resMgr = new ResourceManager(ResourceConstants.BaseName, Assembly.GetExecutingAssembly());
            this._message = resMgr.GetString(ResourceConstants.DispatcherStoppedError);
        }

        /// <summary>
        ///     This constructor accepts a custom error message.
        /// </summary>
        public DispatcherStoppedException(string message)
            : base(message)
        {
            this._message = message;
        }

        /// <summary>
        ///     This constructor accepts a custom error message and an inner exception.
        /// </summary>
        public DispatcherStoppedException(string message, Exception innerException)
            : base(message, innerException)
        {
            this._message = message;
        }

        #endregion

        #region Public Instance Properties

        /// <summary>
        ///     This property returns the message associated with the exception.
        /// </summary>
        public override string Message
        {
            get
            {
                return (this._message);
            }
        }

        #endregion
    }
}
